﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="SatisfactionQuestionnaire.aspx.cs" Inherits="SatisfactionQuestionnaire" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <link href="css/star-rating.css" rel="stylesheet" />
    <script src="js/jquery-ui.min.js"></script>
    <script src="js/star-ratings.js"></script>
    <script>
        jQuery(document).ready(function () {
            $(".rating-kv").rating();
        });
</script>
    <div style="width:960px; height:750px;margin:0 auto;">
        <h1 style="color:black;text-align:center;">這是滿意度調查頁面</h1>
   
         <div style="width:600px; height:370px;margin:0 auto;">
         <asp:Panel ID="Panel1" runat="server" GroupingText="列出未評價的紀錄" Height="350px" Width="600px" BorderStyle="Solid">
             <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Eva_ID" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
                 <Columns>
                     <asp:BoundField DataField="Eva_ID" HeaderText="評價編號" SortExpression="Eva_ID" ReadOnly="True" />
                     <asp:BoundField DataField="Staff_Name" HeaderText="醫生名稱" SortExpression="Staff_Name" />
                     <asp:BoundField DataField="Diag_ND" HeaderText="看診日期" SortExpression="Diag_ND" DataFormatString="{0:d}" />
                     <asp:TemplateField HeaderText="是否評分" SortExpression="Eva_ID" >
                         <EditItemTemplate>
                             <asp:Label ID="Label1" runat="server" Text='<%# Eval("Eva_ID") %>'></asp:Label>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "SatisfactionQuestionnaire.aspx?EvaID="+Eval("Eva_ID") %>'  Text='<%# ClassUtility.getEvaSco((int)Eval("Eva_ID")) %>' Enabled='<%# ClassUtility.Readonly((object)Eval("Eva_Sco")) %>' ></asp:HyperLink>
                         </ItemTemplate>
                         <ItemStyle Font-Bold="True" HorizontalAlign="Center" />
                     </asp:TemplateField>
                 </Columns>
             </asp:GridView>
             <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MedicareConnectionString %>" SelectCommand="SELECT [Eva_ID], [Diag_ND], [Staff_Name],[Eva_Sco] FROM [View_Evaluation] WHERE ([Ptt_ID] = @Ptt_ID)">
                 <SelectParameters>
                     <asp:CookieParameter CookieName="PttID" Name="Ptt_ID" Type="Int32" />
                 </SelectParameters>
             </asp:SqlDataSource>
         </asp:Panel>
        </div>
        <div style="width:600px; height:300px;margin:0 auto;">
         <asp:Panel ID="Panel2" runat="server" GroupingText="評價" Height="300px" Width="600px" BorderStyle="Solid">
             <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource2" DataKeyNames="Eva_ID" DefaultMode="Edit">
                 <EditItemTemplate>
                     
                     評分編號:
                     <asp:Label ID="Eva_IDLabel1" runat="server" Text='<%# Eval("Eva_ID") %>' />
                     <br />
                     評分:
                     <asp:HiddenField ID="TextBox2" runat="server" Value='<%# Bind("Eva_Sco") %>'/>
                     <input id="input-star" value="0" type="number" class="rating" min="0" max="5" step="1" data-size="xs" />
                     <br />
                     評語:
                     <asp:TextBox ID="Eva_ComTextBox" runat="server" Text='<%# Bind("Eva_Com") %>' />
                     <br />
                     (評分送出，即無法修改)<br/>
                     <br/>
                     <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="送出" OnClick="UpdateButton_Click" />
                     &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消" />
                 </EditItemTemplate>
             </asp:FormView>

             &nbsp;<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:MedicareConnectionString %>" SelectCommand="SELECT [Eva_ID], [Eva_Sco], [Eva_Com] FROM [Evaluation] WHERE ([Eva_ID] = @Eva_ID)" UpdateCommand="UPDATE [Evaluation] SET [Eva_Sco] = @Eva_Sco, [Eva_Com] = @Eva_Com WHERE [Eva_ID] = @Eva_ID">
                 <SelectParameters>
                     <asp:QueryStringParameter Name="Eva_ID" QueryStringField="EvaID" Type="Int32" />
                 </SelectParameters>
                 <UpdateParameters>
                     <asp:Parameter Name="Eva_Sco" Type="Int32" />
                     <asp:Parameter Name="Eva_Com" Type="String" />
                     <asp:Parameter Name="Eva_ID" Type="Int32" />
                 </UpdateParameters>
             </asp:SqlDataSource>
             
            </asp:Panel>
        </div>
    </div>
</asp:Content>

